var header = (function (window, $, document, undefined) {
    var basePath = $('#basePath').val(), targetSelectNav = $("#targetSelectNav").val();

    function navChangeFn() {
        $(".headerContainer select").on("change", function () {
            var $select = $(this), $selectOption = $select.find("option:selected"),
                urlTarget = $selectOption.attr("url");
            window.location.href = basePath + urlTarget;
        });
    }

    function initNavSelectOption() {
        $(".headerContainer select option").each(function () {
            var $this = $(this), val = $this.val().trim();
            if (val === targetSelectNav) {
                $this.prop("selected", true);
            }
        });
    }

    return {
        init: function () {
            navChangeFn();
            initNavSelectOption();
        }
    };
})(window, jQuery, document);
